// AE7JO-TK1 Arduino Based Capacitive Touch Keyer
//
// Copyright 2011 Ira Burton, AE7JO [ http://www.ae7jo.net ]
// 
// All trademarks referred to in source code and documentation are copyright their respective owners.

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

#include "wiring.h"

#undef round

#ifndef Structs_h
#define Structs_h

#define EEPROM_VERSION      0x07      // Indicates the version of the settings structure defined in this file
                                      // If the below SettingStruct is changed, this number should be incremented

struct SettingStruct {
  byte EEPROMVersion;                 // The version of the settings structure
  boolean sidetonePlay;               // Wether or not to play the sidetone on the speaker
  unsigned int sidetoneHZ;            // The frequency to play on the external speaker as sidetone
  byte WPM;
};

struct ButtonStates {
  boolean paddleLeft;
  unsigned long leftPressTime;
  boolean paddleRight;
  unsigned long rightPressTime;
  unsigned int buttonValue;
  unsigned long buttonPressTime;
};

struct t_morseValue { char c; byte pat; };
struct t_morseValue t_morseTable[] = {
        // Special Symbols
        {'@', B01010110}, {'.', B01101010}, {',', B01110011}, {'?', B01001100}, {'/', B00101001},
        // Letters
	{'A', B00000110}, {'B', B00010001}, {'C', B00010101}, {'D', B00001001}, {'E', B00000010},
	{'F', B00010100}, {'G', B00001011}, {'H', B00010000}, {'I', B00000100}, {'J', B00011110},
        {'K', B00001101}, {'L', B00010010}, {'M', B00000111}, {'N', B00000101}, {'O', B00001111},
	{'P', B00010110}, {'Q', B00011011}, {'R', B00001010}, {'S', B00001000}, {'T', B00000011},
	{'U', B00001100}, {'V', B00011000}, {'W', B00001110}, {'X', B00011001}, {'Y', B00011101},
	{'Z', B00010011},
	// Numbers
        {'1', B00111110}, {'2', B00111100}, {'3', B00111000}, {'4', B00110000}, {'5', B00100000},
	{'6', B00100001}, {'7', B00100011}, {'8', B00100111}, {'9', B00101111}, {'0', B00111111}
};
#define MORSE_TABLE_SIZE  (sizeof(t_morseTable)/sizeof(t_morseTable[0]))  // Must be smaller than 255

#endif
